package cn.xopencode.securityservice.dal.mysql.mapper.violate;

import cn.xopencode.common.framework.vo.SortingField;
import cn.xopencode.mybatis.core.query.QueryWrapperX;
import cn.xopencode.mybatis.core.util.PageUtil;
import cn.xopencode.securityservice.dal.mysql.dataobject.suggest.SuggestDO;
import cn.xopencode.securityservice.dal.mysql.dataobject.violate.ViolateDO;
import cn.xopencode.securityservice.rpc.suggest.dto.SuggestPageReqDTO;
import cn.xopencode.securityservice.rpc.violate.dto.ViolatePageReqDTO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Repository;

import java.util.Collection;

@Repository
public interface ViolateMapper extends BaseMapper<ViolateDO> {
    default IPage<ViolateDO> selectPage(ViolatePageReqDTO pageReqDTO) {
        return selectPage(PageUtil.build(pageReqDTO, pageReqDTO.getSorts()),
                new QueryWrapperX<ViolateDO>().eqIfPresent("find_time", pageReqDTO.getFindTime()));
    }
    default int update(ViolateDO entity) {
        return update(entity, new QueryWrapper<ViolateDO>()
                .eq("id", entity.getId()));
    }
}


